<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
	
<%
	request.setCharacterEncoding("UTF-8");
	String htmlData = request.getParameter("content1") != null ? request.getParameter("content1") : "";
%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ include file="/WEB-INF/JSP/backHome/modalWindows/argeeCommon.jsp" %>
<%@ include file="/WEB-INF/JSP/backHome/modalWindows/againstAuditCommon.jsp" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="<%=path%>/My97DatePicker/WdatePicker.js"></script>
<link rel="stylesheet" type="text/css" href="<%=path%>/CSS/backLayout.css">
<link rel="stylesheet" type="text/css" href="<%=path%>/CSS/bombBox.css">
</head>
<style>
select{width: 170px;height: 31px}
.gn_name{padding-top: 5px}

.div_zilei {
	width: 94.5%;
	padding-left: 90px;
	height: 30px
}
.tr{height:40px;background: #57a0ff;font-weight:700;}
.tr td{font-size: 14px;color: #ffffff}
.tr_td{height: 40px;}
.tr_td td{border-bottom: 1px solid #ededed;text-align: center;}
tr td:nth-child(1) {font-size: 14px;color: #cccccc}
.date{border: 0;background: #ffffff;text-align: center;}
.tr_td td:nth-child(1){border-left: 1px solid #cccccc;}
.tr_td td:nth-child(3){border-right: 1px solid #cccccc;}
.addTable.deleteTable:HOVER{cursor:pointer;}
type[type='checkbox']{width: 15px}
#table1 input{width: 170px}
#table3 input{width: 170px;}
.fseq2{width:25px;border:none;color:#cccccc;text-align: center;}
.div_input_hang select{width: 234px}
.div_input_hang {
	width: 100%;
	height: 40px;
}
.input_hang {
	float: left;
	width: 500px;
	height: 40px;
}
</style>
<body style="background: #f5f5f5">
<div class="main">
<div id="modal-overlay">
			    
			</div>
			<div class="modal-data1">
				<div style="height: 60px">
				 <ul>
				  	<li  style="text-align: left;margin-left: 60px;height: 40px;line-height: 40px">
				  		<span>车型：</span>
				  		<span>
				  		 	<input class="name" type="text" >
				  		</span>
				  		<span>车牌号码：</span>
				  		<span>
				  		 	<input class="fnumber" type="text" >
				  		</span>
				  		<span>
				  			<button class="findBtn1">
				  				查询
				  			</button>
				  		</span>
				  	</li>
				 </ul>
				</div>
				<div style="width:1100px; height:350px; overflow:scroll;">
				      <form action="">
				        <table class="head1" style="width: auto;white-space:nowrap;border-spacing: 0px">
				        <tr style="background: #f2f2f2;height: 30px;line-height: 20px;" class="sel">
					        <td style="width: 20px"></td> 
					        <td>车型</td>
					        <td>车牌号码</td>
					        <td>简称</td>
					        <td>描述</td>
					        <td>创建时间</td>
					        <td>用户名</td>
					        <td>最后修改时间</td>
					        <td>用户名</td>
					        <td>财务组织</td>
					        <td>入户日期</td>
					        <td>车架号</td>
					        <td>发动机号</td>
					        <td>年检到期日</td>
					        <td>交强险到期日</td>
					        <td>商业险到期日</td>
					        <td>二级维护到期日</td>
					        <td>综检到期日</td>
					        <td>保养到期日</td>
					        <td>科目三通行证到期日</td>
					        <td>所属机构</td>
					        <td>产地</td>
					        <td>品牌</td>
					        <td>保单号</td>
					        <td>商业险日期</td>
					        <td>交强险日期</td>
					        <td>年检日期</td>
					        <td>二级维护日期</td>
					        <td>综检险日期</td>
					        <td>保养日期</td>
					        <td>科目三通行证日期</td>
					        <td>购买价格</td>
					        <td>购买日期</td>
					        <td>理论油耗</td>
				        </tr>
				        <c:forEach items="${cars}" var="cars">
				        <tr style="margin-top: 45px" class="xysj">
				            <td style="width: 20px"><input type="checkbox" class="check" value="${cars.fid}" name="train" style="width: 15px"/></td>
					        <td>${cars.fnameL2}</td>
					        <td>${cars.fnumber}</td>
					        <td>${cars.fsimplename}</td>
					        <td>${cars.fdescriptionL2}</td>
					        <td>${cars.fcreatetime}</td>
					        <td>${cars.createName}</td>
					        <td>${cars.flastupdatetime}</td>
					        <td>${cars.updateName}</td>
					        <td>${cars.companyName}</td>
					        <td>${cars.cfrhrq}</td>
					        <td>${cars.cfcjh}</td>
					        <td>${cars.cffdjh}</td>
					        <td>${cars.cfnjdqr}</td>
					        <td>${cars.cfjqxdqr}</td>
					        <td>${cars.cfsyxdqr}</td>
					        <td>${cars.cfejwhdqr}</td>
					        <td>${cars.cfzjdqr}</td>
					        <td>${cars.cfbydqr}</td>
					        <td>${cars.cfkmstxzdqr}</td>
					        <td>${cars.deptName}</td>
					        <td>${cars.cfcd}</td>
					        <td>${cars.cfpp}</td>
					        <td>${cars.cfbdh}</td>
					        <td>${cars.cfsyxrq}</td>
					        <td>${cars.cfjqxrq}</td>
					        <td>${cars.cfnjrq}</td>
					        <td>${cars.cfejwhrq}</td>
					        <td>${cars.cfzjrq}</td>
					        <td>${cars.cfbyrq}</td>
					        <td>${cars.cfkmstxzrq}</td>
					        <td>${cars.cfgmjg}</td>
					        <td>${cars.cfgmrq}</td>
					        <td>${cars.cfllyh}</td>
				       </tr>
				        </c:forEach>
				        </table>
				      </form>
				</div>
                <button class="subtn1" style="width: 150px;position: absolute;bottom: 25px;font-size: 16px;left: 280px">
				      	确定
				      </button>
                <button class="btn" style="width: 150px;position: absolute;bottom: 25px;font-size: 16px;right: 280px">
				      	关闭
				      </button>
			</div>
		<c:if test="${empty insuranceReg}">
			<div class="weizhi">
				车辆管理>>保险登记>>新增
			</div>
		</c:if>
		<c:if test="${not empty insuranceReg}">
			<c:if test="${insuranceReg.cfbillstate <= 3}">
			<div class="weizhi">
				车辆管理>>保险登记>>修改
			</div>
		</c:if>
		</c:if>
		<c:if test="${not empty insuranceReg}">
			<c:if test="${insuranceReg.cfbillstate > 3}">
			<div class="weizhi">
				车辆管理>>保险登记>>查看
			</div>
		</c:if>
		</c:if>
	<div class="div_body" style="box-shadow: 0 0 5px #cccccc;height: 950px">
			<div class="div_form">
			<!----------------------------- 新增 --------------------------------->
			<c:if test="${empty insuranceReg}">
                <form action="<%=path%>/DrivingSys/editInsuranceReg" class="form" method="post"
                      onsubmit="return verify();">
						<div class="div_input_hang">
							<div class="input_hang">
								<span class="gn_name">驾校&nbsp;:&nbsp;</span>
								<input  type="text" name="name"  value="${department.fnameL2}" readonly="readonly" style="color: gray;"/>
							</div>
							<div class="input_hang">
								<span class="gn_name">单据编号&nbsp;:&nbsp;</span>
								<input  type="text" name="fnumber" value="${fnumber}" style="color: gray;" readonly="readonly"/>
							</div>
							<div class="input_hang">
								<span class="gn_name">业务日期&nbsp;:&nbsp;</span>
								<input  type="text" name="fbizdate"  id="ywrq" value="${time}" 
								onclick="WdatePicker({el:'ywrq',dateFmt:'yyyy-MM-dd'})"/>
								<img onclick="WdatePicker({el:'ywrq',dateFmt:'yyyy-MM-dd'})" 
					            src="<%=path%>/image/date.jpg"  align="absmiddle" style="padding-left: 15px">
							</div>
						</div>
						<div class="div_input_hang">
							<div class="input_hang">
								<span class="gn_name">备注&nbsp;:&nbsp;</span>
								<input name="fdescription"/>
							</div>
							<div class="input_hang">
								<span class="gn_name">单据状态&nbsp;:&nbsp;</span>
								<select name="cfbillstate" disabled="disabled">
									<option style="color: gray;">新增</option>
								</select>
							</div>
					</div>
					
					<div class="div_zilei">
						<div style="width: 83%;text-align: right;">
								<img src="<%=path%>/image/insert2323.jpg" class="addTable">
								<span style="padding-right: 20px;color:#57a0ff;font-weight:700;font-size: 14px" class="addTable">添加</span>
								<img src="<%=path%>/image/delete212.png" class="deleteTable">
								<span class="deleteTable" style="color:#57a0ff;font-weight:700;font-size: 14px" class="deleteTable">删除</span>
							</div>
					</div>
					<input type="hidden" class="stu">
					<div style="min-height: 500px;width: 83%;padding-left: 90px;position: relative;">
					<div style="overflow:scroll;height: 500px;width: 100%"> 
							<table  width="100%" align="center" id="table1" style="min-height:50px;border-spacing:0;">
									<tr class="tr">
										<td  width="20px"></td>
										<td  width="30px"></td>
										<td align="center">车辆</td>
										<td align="center">车牌</td>
										<td align="center">类型</td>
										<td align="center">办理日期</td>
										<td align="center">到期日期</td>
										<td align="center">金额</td>
										<td align="center">备注</td>
									</tr>
							</table>
						</div>
					</div>
					
					
					 <div class="div_input_hang" style="margin-top: 50px">
							<div class="input_hang">
								<span class="gn_name">审核人&nbsp;:&nbsp;</span>
								<input name="fhandlerid" readonly="readonly" style="color: gray;" type="text"/>
							</div>
							<div class="input_hang">
								<span class="gn_name">创建者&nbsp;:&nbsp;</span>
								<input name="fcreatorid2" readonly="readonly" value="${name}" style="color: gray;" type="text"/>
								<input name="fcreatorid" readonly="readonly"  style="color: gray;" type="hidden"/>
							</div>
							<div class="input_hang">
								<span class="gn_name">创建时间&nbsp;:&nbsp;</span>
								<input name="fcreatetime" style="color: gray;"readonly="readonly" type="text"/>
							</div> 
					</div> 
					
					<div class="div_tj" style="padding-top: 20px;margin-left: 140px;">
						<div>
							<input class="input_submit bc" value="" type="submit" style="margin-top: 0px;margin-right: 30px;"/>
						</div>
						<div>
							<input type="button" class="input_back fh" value="" onclick="back()" style="margin-top: 0px;"/>
						</div>
					</div>
				</form>
				</c:if>
				
				<!----------------------------- 修改 --------------------------------->
			<c:if test="${not empty insuranceReg}">
				<c:if test="${insuranceReg.cfbillstate <= 3}">
                <form action="<%=path%>/DrivingSys/editInsuranceReg" class="form" method="post"
                      onsubmit="return verify();">
						<div class="div_input_hang">
							<div class="input_hang">
								<span class="gn_name">驾校&nbsp;:&nbsp;</span>
								<input  type="text" name="name"  value="${insuranceReg.companyName}" readonly="readonly" style="color: gray;"/>
								<input type="hidden" value="${insuranceReg.fid}" name="fid" id="fid">
							</div>
							<div class="input_hang">
								<span class="gn_name">单据编号&nbsp;:&nbsp;</span>
								<input type="text" name="fnumber" id="fnumber" value="${insuranceReg.fnumber}"
									   style="color: gray;" readonly="readonly"/>
							</div>
							<div class="input_hang">
								<span class="gn_name">业务日期&nbsp;:&nbsp;</span>
								<input  type="text" name="fbizdate"  id="ywrq" value="${insuranceReg.fbizdate}" 
								onclick="WdatePicker({el:'ywrq',dateFmt:'yyyy-MM-dd'})"/>
								<img onclick="WdatePicker({el:'ywrq',dateFmt:'yyyy-MM-dd'})" 
					            src="<%=path%>/image/date.jpg"  align="absmiddle" style="padding-left: 15px">
							</div>
						</div>
						<div class="div_input_hang">
							<div class="input_hang">
								<span class="gn_name">备注&nbsp;:&nbsp;</span>
								<input name="fdescription" value="${insuranceReg.fdescription}"/>
							</div>
							<div class="input_hang">
								<span class="gn_name">单据状态&nbsp;:&nbsp;</span>
								<select name="cfbillstate" disabled="disabled">
									<option style="color: gray;">保存</option>
								</select>
							</div>
					</div>
					
					<div class="div_zilei">
						<div style="width: 83%;text-align: right;">
								<img src="<%=path%>/image/insert2323.jpg" class="addTable">
								<span style="padding-right: 20px;color: #57a0ff;font-weight:700;font-size: 14px" class="addTable">添加</span>
								<img src="<%=path%>/image/delete212.png" class="deleteTable">
								<span class="deleteTable" style="color:#57a0ff;font-weight:700;font-size: 14px" class="deleteTable">删除</span>
							</div>
					</div>
					<input type="hidden" class="stu">
					<input type="hidden" id="auditState" value="${AuditState}">
					<div style="min-height: 500px;width: 83%;padding-left: 90px;position: relative;">
					<div style="overflow:scroll;height: 500px;width: 100%"> 
							<table  width="100%" align="center" id="table1" style="min-height:50px;border-spacing:0;">
									<tr class="tr">
										<td  width="20px"></td>
										<td  width="30px"></td>
										<td align="center">车辆</td>
										<td align="center">车牌</td>
										<td align="center">类型</td>
										<td align="center">办理日期</td>
										<td align="center">到期日期</td>
										<td align="center">金额</td>
										<td align="center">备注</td>
									</tr>
									<c:forEach items="${insuranceRegEntrys}" var="s">
									<tr style="margin-top: 45px" class="jx${s.fseq}">
										<td width="20px"><input type="checkbox" name="check" style="width: 15px"></td>
										<td>
											<input type="text" readonly="readonly" class="fseq2" value="${s.fseq}" style="width: 40px">
											<input type="hidden" name="fseq" class="fseq" value="${s.fseq}">
										</td>
										<td><input type="text" name="carName" class="carName is_click_ne"
												   onclick="cl($(this))" value="${s.carName}"></td>
										<td>
											<input type="text" name="cfcarnumber" class="cfcarnumber" readonly unselectable="on" value="${s.cfcarnumber}">
											<input type="hidden" name="cfcarid" value="${s.cfcarid}">
										</td>
										<td><select name="cftype">
												<c:if test="${s.cftype == '1'}">
													<option value="1" selected="selected">年检</option>
													<option value="2">交强险</option>
													<option value="3">商业险</option>
													<option value="4">二级维护</option>
													<option value="5">综检</option>
													<option value="6">科目三通行证</option>
												</c:if>
												<c:if test="${s.cftype == '2'}">
													<option value="1">年检</option>
													<option value="2" selected="selected">交强险</option>
													<option value="3">商业险</option>
													<option value="4">二级维护</option>
													<option value="5">综检</option>
													<option value="6">科目三通行证</option>
												</c:if>
												<c:if test="${s.cftype == '3'}">
													<option value="1">年检</option>
													<option value="2">交强险</option>
													<option value="3" selected="selected">商业险</option>
													<option value="4">二级维护</option>
													<option value="5">综检</option>
													<option value="6">科目三通行证</option>
												</c:if>
												<c:if test="${s.cftype == '4'}">
													<option value="1">年检</option>
													<option value="2">交强险</option>
													<option value="3">商业险</option>
													<option value="4" selected="selected">二级维护</option>
													<option value="5">综检</option>
													<option value="6">科目三通行证</option>
												</c:if>
												<c:if test="${s.cftype == '5'}">
													<option value="1">年检</option>
													<option value="2">交强险</option>
													<option value="3">商业险</option>
													<option value="4">二级维护</option>
													<option value="5" selected="selected">综检</option>
													<option value="6">科目三通行证</option>
												</c:if>
												<c:if test="${s.cftype == '6'}">
													<option value="1">年检</option>
													<option value="2">交强险</option>
													<option value="3">商业险</option>
													<option value="4">二级维护</option>
													<option value="5">综检</option>
													<option value="6"  selected="selected">科目三通行证</option>
												</c:if>
												<c:if test="${empty s.cftype}">
													<option value="1">年检</option>
													<option value="2">交强险</option>
													<option value="3">商业险</option>
													<option value="4">二级维护</option>
													<option value="5">综检</option>
													<option value="6">科目三通行证</option>
												</c:if>
											</select>
										</td>
										<td><input type="text" name="cfbizdate" class="cfbizdate" id="blrq${s.fseq}"
												   value="${s.cfbizdate}"
												   onclick="WdatePicker({el:'blrq${s.fseq}',dateFmt:'yyyy-MM-dd'})"
												   onblur="compareTime($(this))"></td>
										<td><input type="text" name="cfenddate" class="cfenddate" id="dqrq${s.fseq}"
												   value="${s.cfenddate}"
												   onclick="WdatePicker({el:'dqrq${s.fseq}',dateFmt:'yyyy-MM-dd'})"
												   onblur="compareTime($(this))"></td>
										<td><input type="text" name="cfamount" class="cfamount" value="${s.cfamount}"
												   onblur="cfamount2($(this))"></td>
										<td><input type="text" name="cfremark" class="cfremark" value="${s.cfremark}"></td>
									</tr>
									</c:forEach>
							</table>
						</div>
					</div>
					
					 <div class="div_input_hang" style="margin-top: 50px">
							<div class="input_hang">
								<span class="gn_name">审核人&nbsp;:&nbsp;</span>
								<input name="fhandlerid" readonly="readonly" style="color: gray;" type="text" value="${insuranceReg.auditName}"/>
							</div>
							<div class="input_hang">
								<span class="gn_name">创建者&nbsp;:&nbsp;</span>
								<input name="fcreatorid2" readonly="readonly" value="${insuranceReg.createName}" style="color: gray;" type="text"/>
							</div>
							<div class="input_hang">
								<span class="gn_name">创建时间&nbsp;:&nbsp;</span>
								<input name="fcreatetime" style="color: gray;"readonly="readonly" type="text" value="${insuranceReg.fcreatetime}"/>
							</div> 
					</div>

					<div class="div_tj" style="padding-top: 0px">
						<shiro:hasPermission name="/queryInsuranceRegByFid">
							<div>
								<input class="input_submit bc" value="" type="submit">
							</div>
						</shiro:hasPermission>
						<shiro:hasPermission name="/submitInsuranceReg">
							<div style="padding-right: 50px">
								<input type="button" class="input_submit tj" value="" id="submit">
							</div>
						</shiro:hasPermission>
						<input type="hidden" id="auditState" value="${AuditState}">
						<div>
							<input type="button" class="input_back fh" value="" onclick="back()"/>
						</div>
					</div>
				</form>
				</c:if>
				</c:if>
				
				<!----------------------------- 查看 --------------------------------->
			<c:if test="${not empty insuranceReg}">
				<c:if test="${insuranceReg.cfbillstate > 3 }">
				<form action="<%=path%>/DrivingSys/editInsuranceReg" class="form">
						<div class="div_input_hang">
							<div class="input_hang">
								<span class="gn_name">驾校&nbsp;:&nbsp;</span>
								<input  type="text" name="name"  value="${insuranceReg.companyName}" readonly="readonly" style="color: gray;"/>
								<input type="hidden" value="${insuranceReg.fid}" name="fid" id="fid">
							</div>
							<div class="input_hang">
								<span class="gn_name">单据编号&nbsp;:&nbsp;</span>
								<input type="text" name="fnumber" id="fnumber" value="${insuranceReg.fnumber}"
									   style="color: gray;" readonly="readonly"/>
							</div>
							<div class="input_hang">
								<span class="gn_name">业务日期&nbsp;:&nbsp;</span>
								<input  type="text" name="fbizdate"  id="ywrq" value="${insuranceReg.fbizdate}" readonly="readonly"/>
								<img  src="<%=path%>/image/date.jpg" style="padding-left: 15px">
							</div>
						</div>
						<div class="div_input_hang">
							<div class="input_hang">
								<span class="gn_name">备注&nbsp;:&nbsp;</span>
								<input name="fdescription" value="${insuranceReg.fdescription}" readonly="readonly"/>
							</div>
							<div class="input_hang">
								<span class="gn_name">单据状态&nbsp;:&nbsp;</span>
								<select name="cfbillstate" disabled="disabled">
									<c:if test="${insuranceReg.cfbillstate == 4}">
										<option style="color: gray;">提交</option>
									</c:if>
									<c:if test="${insuranceReg.cfbillstate == 5}">
										<option style="color: gray;">审核</option>
									</c:if>
								</select>
							</div>
					</div>
					
					<div class="div_zilei">
							<div style="width: 88%;text-align: right;">
									<%--<img src="<%=path%>/image/insert2323.jpg">
                                    <span style="padding-right: 20px;color: #a9bbe0;font-size: 14px">添加</span>
                                    <img src="<%=path%>/image/delete212.png">
                                    <span style="color: #a9bbe0;font-size: 14px">删除</span>--%>
							</div>
					</div>
					<input type="hidden" id="state" value="${insuranceReg.cfbillstate}">
					<input type="hidden" class="stu">
					<input type="hidden" id="type">
					<div style="min-height: 500px;width: 88%;padding-left: 90px;position: relative;">
					<div style="overflow:scroll;height: 500px;width: 100%"> 
							<table  width="100%" align="center" id="table3" style="min-height:50px;border-spacing:0;">
									<tr class="tr">
										<td  width="20px"></td>
										<td  width="30px"></td>
										<td align="center">车辆</td>
										<td align="center">车牌</td>
										<td align="center">类型</td>
										<td align="center">办理日期</td>
										<td align="center">到期日期</td>
										<td align="center">金额</td>
										<td align="center">备注</td>
									</tr>
									<c:forEach items="${insuranceRegEntrys}" var="s">
									<tr style="margin-top: 45px" class="jx${s.fseq}">
										<td width="20px"><input type="checkbox" name="check" style="width: 15px" disabled="disabled"></td>
										<td>
											<input type="text" readonly="readonly" class="fseq2" value="${s.fseq}" style="width: 40px">
											<input type="hidden" name="fseq" class="fseq" value="${s.fseq}">
										</td>
										<td><input type="text" name="carName" class="carName" readonly="readonly" value="${s.carName}"></td>
										<td>
											<input type="text" name="cfcarnumber" class="cfcarnumber" readonly="readonly" value="${s.cfcarnumber}">
											<input type="hidden" name="cfcarid" value="${s.cfcarid}">
										</td>
										<td><select name="cftype" disabled="disabled">
												<c:if test="${s.cftype == '1'}">
													<option value="1" selected="selected">年检</option>
													<option value="2">交强险</option>
													<option value="3">商业险</option>
													<option value="4">二级维护</option>
													<option value="5">综检</option>
													<option value="6">科目三通行证</option>
												</c:if>
												<c:if test="${s.cftype == '2'}">
													<option value="1">年检</option>
													<option value="2" selected="selected">交强险</option>
													<option value="3">商业险</option>
													<option value="4">二级维护</option>
													<option value="5">综检</option>
													<option value="6">科目三通行证</option>
												</c:if>
												<c:if test="${s.cftype == '3'}">
													<option value="1">年检</option>
													<option value="2">交强险</option>
													<option value="3" selected="selected">商业险</option>
													<option value="4">二级维护</option>
													<option value="5">综检</option>
													<option value="6">科目三通行证</option>
												</c:if>
												<c:if test="${s.cftype == '4'}">
													<option value="1">年检</option>
													<option value="2">交强险</option>
													<option value="3">商业险</option>
													<option value="4" selected="selected">二级维护</option>
													<option value="5">综检</option>
													<option value="6">科目三通行证</option>
												</c:if>
												<c:if test="${s.cftype == '5'}">
													<option value="1">年检</option>
													<option value="2">交强险</option>
													<option value="3">商业险</option>
													<option value="4">二级维护</option>
													<option value="5" selected="selected">综检</option>
													<option value="6">科目三通行证</option>
												</c:if>
												<c:if test="${s.cftype == '6'}">
													<option value="1">年检</option>
													<option value="2">交强险</option>
													<option value="3">商业险</option>
													<option value="4">二级维护</option>
													<option value="5">综检</option>
													<option value="6"  selected="selected">科目三通行证</option>
												</c:if>
												<c:if test="${empty s.cftype}">
													<option value="1">年检</option>
													<option value="2">交强险</option>
													<option value="3">商业险</option>
													<option value="4">二级维护</option>
													<option value="5">综检</option>
													<option value="6">科目三通行证</option>
												</c:if>
											</select>
										</td>
										<td><input type="text" name="cfbizdate" class="cfbizdate"  value="${s.cfbizdate}" readonly="readonly"></td>
										<td><input type="text" name="cfenddate" class="cfenddate"  value="${s.cfenddate}" readonly="readonly"></td>
										<td><input type="text" name="cfamount" class="cfamount" value="${s.cfamount}" readonly="readonly"></td>
										<td><input type="text" name="cfremark" class="cfremark" value="${s.cfremark}" readonly="readonly"></td>
									</tr>
									</c:forEach>
							</table>
						</div>
					</div>
					
					 <div class="div_input_hang" style="margin-top: 50px">
							<div class="input_hang">
								<span class="gn_name">审核人&nbsp;:&nbsp;</span>
								<input name="fhandlerid" readonly="readonly" style="color: gray;" type="text" value="${insuranceReg.auditName}"/>
							</div>
							<div class="input_hang">
								<span class="gn_name">创建者&nbsp;:&nbsp;</span>
								<input name="fcreatorid2" readonly="readonly" value="${insuranceReg.createName}" style="color: gray;" type="text"/>
							</div>
							<div class="input_hang">
								<span class="gn_name">创建时间&nbsp;:&nbsp;</span>
								<input name="fcreatetime" style="color: gray;"readonly="readonly" type="text" value="${insuranceReg.fcreatetime}"/>
							</div> 
					</div> 
					
					<div class="div_tj">
						<c:if test="${AuditState == 'true'}">
							<shiro:hasPermission name="/auditInsuranceReg">
								<div style="padding-right: 50px">
									<input type="button" class="input_submit sh" value="" id="sh">
									<input type="hidden" value="1">
								</div>
							</shiro:hasPermission>
						</c:if>
						<shiro:hasPermission name="/againstAuditInsuranceReg">
							<div style="padding-right: 50px">
								<input type="button" class="input_submit fsh" value="" id="fsh">
							<input type="hidden" value="2">
						</div>
						</shiro:hasPermission>
						<div>
							<input type="button" class="input_submit cklc" value=""
								   onclick="lookActivitiImg('${key}',$('#fnumber').val())"/>
						</div>
						<div>
							<input type="button" class="input_back fh" value="" onclick="back()"/>
						</div>
				</div>
				</form>
				</c:if>
				</c:if>
				
		</div>
	</div>
</div>
</body>
<script type="text/javascript" src="<%=path%>/JQuery/jquery-1.8.2.js"></script>
<%@ include file="/WEB-INF/JSP/ajax.jsp"%>
<script type="text/javascript" src="<%=path%>/HoganJS/handlebars-v4.0.11.js"></script>
<script type="text/javascript">

$(document).ready(function(){
	var type = "${type}"
	if(type == null || type == ''){
		
	}else{
        editAlert();
	}
})

//删除行
$(".deleteTable").click(function(){
	var tr_len = $("#table1 tr").length;
	if(tr_len == 1){
		
	}else{
		var s = '';
		$('input:checkbox[name=check]').each(function(i) {
			if($(this).is(':checked')){
				$(this).parent().parent().remove();
				s = '1';
			}
		})
		//判断是否选中
		if(s == null || s == ''){
			alert("请选择一条数据删除");
			return false;
		}
		if($("#table1 tr").length == 2){
			$("#table2").css('display','none')
		}
		//重新排序
		$('#table1 tr td .fseq').each(function(i) {
			var s = i*1 + 1*1;
			$(this).val(s);
			$(this).prev().val(s);
			$(this).parent().parent().attr("class",'jx'+s);
			var blrq = 'blrq'+s;//办理日期
			var dqrq = 'dqrq'+s;//结束日期
			$(this).parent().parent().find(".cfbizdate").attr("id",blrq)
			$(this).parent().parent().find(".cfbizdate").attr("onclick", "WdatePicker({el:"+blrq+",dateFmt:'yyyy-MM-dd'})")
			$(this).parent().parent().find(".cfenddate").attr("id",dqrq)
			$(this).parent().parent().find(".cfenddate").attr("onclick", "WdatePicker({el:"+dqrq+",dateFmt:'yyyy-MM-dd'})")
		})
	}
})
//返回
function back(){
    parent.closeSelectCard()

//    location = '<%=path%>/DrivingSys/queryInsuranceReg/look.action';
}

//开启学员弹框
 function cl(_this){
	var jx = _this.parent().parent().prop("class");
	$(".stu").val(jx)
	$('#modal-overlay').css('visibility','visible')
	$('.modal-data1').css('visibility','visible')
}

//添加一行
$('.addTable').click(function(){
	 var tr_len = $("#table1 tr").length;
	 var str = ""
	 str+='<tr style="margin-top: 45px" class=jx'+tr_len+'>'
	 str+='<td width="20px"><input type="checkbox" name="check" style="width: 15px"></td>'
	 str+='<td><input type="text" readonly="readonly" class="fseq2" value='+tr_len+' style="width: 40px"><input type="hidden" name="fseq" class="fseq" value='+tr_len+'></td>'
    str += '<td><input type="text" name="carName" class="carName is_click_ne" onclick = "cl($(this))"></td>'
	 str+='<td><input type="text" name="cfcarnumber" class="cfcarnumber" readonly unselectable="on"><input type="hidden" name="cfcarid"></td>'
	 str+='<td><select name="cftype"><option value="1">年检</option><option value="2">交强险</option><option value="3">商业险</option>'
	 str+='<option value="4">二级维护</option><option value="5">综检</option><option value="6">科目三通行证</option></select></td>'
	 var blrq = 'blrq'+tr_len//办理日期
	 var dqrq = 'dqrq'+tr_len//到期日期
    str += '<td><input type="text" name="cfbizdate" class="cfbizdate" id="' + blrq + '" onclick=\"WdatePicker({el:\'' + blrq + '\',dateFmt:\'yyyy-MM-dd\'})\" onblur="compareTime($(this))"></td>'
    str += '<td><input type="text" name="cfenddate" class="cfenddate" id="' + dqrq + '" onclick=\"WdatePicker({el:\'' + dqrq + '\',dateFmt:\'yyyy-MM-dd\'})\" onblur="compareTime($(this))"></td>'
    str += '<td><input type="text" name="cfamount" class="cfamount" onblur="cfamount2($(this))"></td>'
	 str+='<td><input type="text" name="cfremark" class="cfremark"></td>'
	 $("#table1").append(str)
})
//金额
function cfamount2(_this) {
    //避免最后一个字符串是.
    _this.val((_this.val().replace(/\.$/g, "")));
    if (_this.val() == '-') {
        _this.val("")
    }
    //判断输入错误
    if (isNaN(Number(_this.val()))) {
        _this.val("")
    }
}
//比较时间
function compareTime(_this) {
    var startTime, endTime;
    var name = _this.prop("name");
    if (name == 'cfbizdate') {
        startTime = _this.val();
        endTime = _this.parent().next().find("input").val();
    } else {
        endTime = _this.val();
        startTime = _this.parent().prev().find("input").val();
    }
    if (startTime != '' && endTime != '') {
        var day1 = new Date(startTime);
        var day2 = new Date(endTime);
        if ((day1.getTime() - day2.getTime()) > 0) {
            alert("开始时间不能大于结束时间");
            if (name == 'cfbizdate') {
                _this.val("");
                _this.parent().next().find("input").val("");
            } else {
                _this.val("");
                _this.parent().prev().find("input").val("");
            }
        }
    }
}
 //可以输入小数点
 $(".cfamount").live('keyup', function(event) {
	    //最后一位是小数点的话，移除
		var $amountInput = $(this);
		//响应鼠标事件，允许左右方向键移动 
		event = window.event || event;
		if(event.keyCode == 37 | event.keyCode == 39) {
			return;
		}
     //获取父类class名称
     var superclass = $(this).parent().parent().prop("class")
		var clazz = $(this).prop("class")
		//获取输入框的值
		var value = $('.'+clazz+'').val();
		//判断负数是否在第一位
		 if(value.substring(0,1) == '-'){
			
		 }
		//判断负数不是在第一位，替换
		 if(value.lastIndexOf('-') > 0){
             $('.superclass .' + clazz + '').val("")
			// $amountInput.val($amountInput.val().replace('-','')
		 }
		//先把非数字的都替换掉，除了数字和. 
		$amountInput.val($amountInput.val().replace(/[^\-?\d.]/g, "").
		//只允许一个小数点              
		replace(/^\./g, "").replace(/\.{2,}/g, ".").
		//只能输入小数点后两位
		replace(".", "$#$").replace(/\./g, "").replace("$#$", ".").replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'));
});

/* 关闭弹出框    */
$('.btn').click(function(){
	$('#modal-overlay').css('visibility','hidden')
	$('.modal-data1').css('visibility','hidden')
})
//根据名称查询车辆
$('.findBtn1').click(function(){
	 var name=$('.name').val()
	 var fnumber = $(".fnumber").val();
		 $.ajax({
			    url:'<%=path%>/DrivingSys/queryCarByInfo', 
			    type: "post",
			    data:{'name':name,'fnumber':fnumber},
			    dataType:"json",         	
			    success: function(json) {
	            var str=''
	            for(var i=0;i<json.length;i++) {
	            	 str+='<tr style="margin-top: 45px;height: 30px;" class="xysj"><td><input style="width: 15px;height: 15px" '
	  	             str+='type="checkbox" name="train"  value="'+json[i].fid+'"></td>'
	               if( json[i].fnameL2 == null){
	        	   		str+='<td></td>'
	               }else{
	            		str+='<td>'+json[i].fnameL2+'</td>'  
	               }
	               if(json[i].fnumber == null){
	            		str+='<td></td>'	
	               }else{
	                	str+='<td>'+json[i].fnumber+'</td>'   
	               }
	               if(json[i].fsimplename != null){
		            	str+='<td>'+json[i].fsimplename+'</td>'	
		           }else{
		                str+='<td></td>'   
		           }
	               if(json[i].fdescriptionL2 != null){
		            	str+='<td>'+json[i].fdescriptionL2+'</td>'	
		           }else{
		                str+='<td></td>'   
		           }
	               if(json[i].fcreatetime != null){
		            	str+='<td>'+json[i].fcreatetime+'</td>'	
		           }else{
		                str+='<td></td>'   
		           }
	               if(json[i].createName != null){
		            	str+='<td>'+json[i].createName+'</td>'	
		           }else{
		                str+='<td></td>'   
		           }
	               if(json[i].flastupdatetime != null){
		            	str+='<td>'+json[i].flastupdatetime+'</td>'	
		           }else{
		                str+='<td></td>'   
		           }
	               if(json[i].updateName != null){
		            	str+='<td>'+json[i].updateName+'</td>'	
		           }else{
		                str+='<td></td>'   
		           }
	               if(json[i].companyName != null){
		            	str+='<td>'+json[i].companyName+'</td>'	
		           }else{
		                str+='<td></td>'   
		           }
	               if(json[i].cfrhrq != null){
		            	str+='<td>'+json[i].cfrhrq+'</td>'	
		           }else{
		                str+='<td></td>'   
		           }
	               if(json[i].cfcjh != null){
		            	str+='<td>'+json[i].cfcjh+'</td>'	
		           }else{
		                str+='<td></td>'   
		           }
	               if(json[i].cffdjh != null){
		            	str+='<td>'+json[i].cffdjh+'</td>'	
		           }else{
		                str+='<td></td>'   
		           }
	               if(json[i].cfnjdqr != null){
		            	str+='<td>'+json[i].cfnjdqr+'</td>'	
		           }else{
		                str+='<td></td>'   
		           }
	               if(json[i].cfjqxdqr != null){
		            	str+='<td>'+json[i].cfjqxdqr+'</td>'	
		           }else{
		                str+='<td></td>'   
		           }
	               if(json[i].cfsyxdqr != null){
		            	str+='<td>'+json[i].cfsyxdqr+'</td>'	
		           }else{
		                str+='<td></td>'   
		           }
	               if(json[i].cfejwhdqr != null){
		            	str+='<td>'+json[i].cfejwhdqr+'</td>'	
		           }else{
		                str+='<td></td>'   
		           }
	               if(json[i].cfzjdqr != null){
		            	str+='<td>'+json[i].cfzjdqr+'</td>'	
		           }else{
		                str+='<td></td>'   
		           }
	               if(json[i].cfbydqr != null){
		            	str+='<td>'+json[i].cfbydqr+'</td>'	
		           }else{
		                str+='<td></td>'   
		           }
	               if(json[i].cfkmstxzdqr != null){
		            	str+='<td>'+json[i].cfkmstxzdqr+'</td>'	
		           }else{
		                str+='<td></td>'   
		           }
	               if(json[i].deptName != null){
		            	str+='<td>'+json[i].deptName+'</td>'	
		           }else{
		                str+='<td></td>'   
		           }
	               if(json[i].cfcd != null){
		            	str+='<td>'+json[i].cfcd+'</td>'	
		           }else{
		                str+='<td></td>'   
		           }
	               if(json[i].cfpp != null){
		            	str+='<td>'+json[i].cfpp+'</td>'	
		           }else{
		                str+='<td></td>'   
		           }
	               if(json[i].cfbdh != null){
		            	str+='<td>'+json[i].cfbdh+'</td>'	
		           }else{
		                str+='<td></td>'   
		           }
	               if(json[i].cfsyxrq != null){
		            	str+='<td>'+json[i].cfsyxrq+'</td>'	
		           }else{
		                str+='<td></td>'   
		           }
	               if(json[i].cfjqxrq != null){
		            	str+='<td>'+json[i].cfjqxrq+'</td>'	
		           }else{
		                str+='<td></td>'   
		           }
	               if(json[i].cfnjrq != null){
		            	str+='<td>'+json[i].cfnjrq+'</td>'	
		           }else{
		                str+='<td></td>'   
		           }
	               if(json[i].cfejwhrq != null){
		            	str+='<td>'+json[i].cfejwhrq+'</td>'	
		           }else{
		                str+='<td></td>'   
		           }
	               if(json[i].cfzjrq != null){
		            	str+='<td>'+json[i].cfzjrq+'</td>'	
		           }else{
		                str+='<td></td>'   
		           }
	               if(json[i].cfbyrq != null){
		            	str+='<td>'+json[i].cfbyrq+'</td>'	
		           }else{
		                str+='<td></td>'   
		           }
	               if(json[i].cfkmstxzrq != null){
		            	str+='<td>'+json[i].cfkmstxzrq+'</td>'	
		           }else{
		                str+='<td></td>'   
		           }
	               if(json[i].cfgmjg != null){
		            	str+='<td>'+json[i].cfgmjg+'</td>'	
		           }else{
		                str+='<td></td>'   
		           }
	               if(json[i].cfgmrq != null){
		            	str+='<td>'+json[i].cfgmrq+'</td>'	
		           }else{
		                str+='<td></td>'   
		           }
	               if(json[i].cfllyh != null){
		            	str+='<td>'+json[i].cfllyh+'</td>'	
		           }else{
		                str+='<td></td>'   
		           }
	               str+='</tr>';
	            }
	            $(".head1 tr:not(':first')").remove()
	            $('.head1').append(str)
				},  
 				error: function(){alert('Error');} 
 	 		});
		
	})
 
 //单击选中
 $(".xysj td").live('click',function(){
    $('input:checkbox[name=train]:checked').each(function(i) {
    	$(this).removeAttr("checked");
     });
       $(this).parent().find("input:checkbox").attr('checked','checked');
  })  

 //由于和input:checkbox冲突，在选择一次
 $("#table1 tr td input:checkbox").live('click',function(){
	 if($(this).is(':checked')){
	    	$(this).removeAttr("checked");
	    }else{
	    	$(this).attr("checked",":checked")
	    }
 })
  //单击选中
  $("#table1 tr td").live('click',function(){
    if($(this).parent().find("input:checkbox").is(':checked')){
    	$(this).parent().find("input:checkbox").removeAttr("checked");
    }else{
    	$(this).parent().find("input:checkbox").attr("checked",":checked")
    }
 }) 
  
//选择数据
 $('.subtn1').click(function () {
	 var fseq = $(".stu").val();
	 var fid = "";//fid
	 var carName = "";//车辆
	 var carNumber = "";//车牌
	 $('input:checkbox[name=train]:checked').each(function (i) {
	         if (0 == i) {
	             fid = $(this).val();
	             carName = $(this).parent().next().text();
	             carNumber = $(this).parent().next().next().text();
	         }
	 });
	 if(fid == ""){
		alert("请至少选择一条数据")
		return false
	}
	carData(fseq,fid,carName,carNumber);
 });
 
 //双击确定
   $(document).on('dblclick','.xysj td',function(){
	     var fseq = $(".stu").val();
	     var fid = "";//fid
		 var carName = "";//车辆
		 var carNumber = "";//车牌
		 $('input:checkbox[name=train]:checked').each(function (i) {
			  if (0 == i) {
				  fid = $(this).val();
		          carName = $(this).parent().next().text();
		          carNumber = $(this).parent().next().next().text();
			   } 
		 });
		 carData(fseq,fid,carName,carNumber);
   })
//放入车辆数据
function carData(fseq,fid,carName,carNumber){
 	 $('.'+fseq+'').find(".carName").val(carName);
 	 $('.'+fseq+'').find(".cfcarnumber").val(carNumber);
 	 $('.'+fseq+'').find(".cfcarnumber").next().val(fid);
 	$('#modal-overlay').css('visibility','hidden')
	$('.modal-data1').css('visibility','hidden')
 }
//num是要处理的数字  v为要保留的小数位数
function decimal(num,v){
	var vv = Math.pow(10,v);
	return Math.round(num*vv)/vv;
}

//审核,反审核弹框
$("#sh,#fsh").click(function () {
    var type = $(this).next().val();
    $("#type").val(type)
    if (type == 1) {
        $('#modal-overlay').css('visibility', 'visible')
        $('.modal-data9').css('visibility', 'visible')
        $('li input:radio:first').attr('checked', 'checked');
    }
    else if (type == 2) {
        $('#modal-overlay').css('visibility', 'visible')
        $('.modal-data10').css('visibility', 'visible')
    }
})

//审核,反审核
$("#auditsubmit,#againstAuditsubmit").click(function () {
    //防止重复提交
    $(this).attr("disabled", "disabled")
    var state = $('li input[type="radio"]:checked ').val();//同意/不同意
    var fid = $("#fid").val();//fid
    var fnumber = $("input[name='fnumber']").val();//编码
    var type = $("#type").val();
    var message;
    if (type == '1') {
        message = $("#auditcomment").val();
    } else {
        message = $("#againstAuditcomment").val();
    }
    $.ajax({
        url: '<%=path%>/DrivingSys/auditInsuranceReg',
        type: "post",
        data: {'fid': fid, 'type': type, 'fnumber': fnumber, 'message': message, 'state': state},
        dataType: "json",
        success: function (json) {
            var url = '/queryInsuranceReg/look.action';
            if (type == '1') {
                if (json == '1') {
                    showAlert('审核成功,并且此流程已结束', url)
                } else if (json == '2') {
                    showAlert('审核成功', url)
                } else {
                    showAlert('审核失败', url)
                }
            } else {
                if (json == '1') {
                    showAlert('反审核成功', url)
                } else if (json == '2') {
                    showAlert('没有找到任务', url)
                } else if (json == '0') {
                    showAlert('找不到流程节点', url)
                }
            }
        },
        error: function () {
            $("#againstAuditsubmit,#auditsubmit").attr("disabled", false)//去除input元素的disabled属性
            alert('错误');
        }
    })
})

//提交
$("#submit").click(function () {
    $.messager.confirm('提示', '是否提交,提交后不会改变修改后的值', function (r) {
        if (r) {
            var url = '/queryInsuranceReg/look.action';
            var fid = $("#fid").val();
            var fnumber = $("input[name='fnumber']").val();
            var auditState = $("#auditState").val();
            $.ajax({
                url: '<%=path%>/DrivingSys/submitInsuranceReg',
                type: "post",
                data: {'fid': fid, 'fnumber': fnumber, 'auditState': auditState},
                dataType: "json",
                success: function (json) {
                    if (json == 1) {
                        showAlert('提交成功', url)
                    } else {
                        showAlert('提交失败', url)
                    }
                },
                error: function () {
                    alert('错误');
                }
            })
        }
    })
})
//验证单据下是否有数据
function verify() {
    var s = 0;
    var a = 0;
    $("input[name='cfcarid']").each(function () {
        if ($(this).val() == '' || $(this).val() == null) {
            a = 1;
        } else {
            s = 1;
        }

    })
    var ywrq = $("#ywrq").val();
    if (ywrq == null || ywrq == '') {
        alert("业务日期不能为空");
        return false;
    }

    if (a == 1) {
        alert("车辆不能为空")
        return false;
    }

    if (s == 0) {
        alert("请至少添加一条数据");
        return false;
    }
    $("input[type='submit']").attr("disabled", "disabled");
}
</script>
</html>